import request from "@/utils/request";

/**
 * 生产需求管理api接口集合
 * @method getList 列表
 * @method postAdd 新增
 * @method putEdit 修改
 * @method deleteDel 删除
 */

export function getList(params) {
    // if(params){
    //     params['integrationFlag'] = 'true';
    // }else{
    //     params = {
    //         'integrationFlag':'true'
    //     };
    // }
    return request({
        url: "/mes/workRequestController/list",
        method: "get",
        params
    });
}

export function getEditingList(params){
    if(params){
        params['integrationFlag'] = 'true';
    }else{
        params = {
            'integrationFlag':'true'
        };
    }
    let user = Session.get(USER_INFO);
    params['zeRenDeptId'] = user.deptGroupId;
    return request({
        url: "/mes/workRequestController/listCanUse",
        method: "get",
        params
    });
}
export function postAdd(data) {
    return request({
        url: "/mes/workRequestController/manualAdd",
        method: "post",
        data: data
    });
}
export function putEdit(data) {
    return request({
        url: "/mes/workRequestController/edit",
        method: "put",
        data: data
    });
}
export function deleteDel(ids) {
    return request({
        url: "/mes/workRequestController/" + ids,
        method: "delete"
    });
}
export function getObject(id){
    return request({
        url: "/mes/workRequestController/" + id,
        method:'get'
    });
}

export function doObsoletedPlan(data) {
    return request({
        url: "/mes/workRequestController/obsoleted",
        method: "post",
        data: data
    });
}

export  function  reAlertUndoById(data){
    return request({
        url: "/mes/workRequestController/reAlertUndo",
        method: "post",
        data: data,
    });
}
